<template>
  <div>
    <div v-for="(v, i) in arr" :key="i">
      <div class="boxa">
        <div class="boxb">
          <span class="iconfont icon-shuxian"></span>
          <div>{{ arr[0][i].title1 }}</div>
        </div>
        <div @click="fun()">
          <div id="boxc" v-for="(item, index) in v" :key="index">
            <div><img :src="item.imgsrc" /></div>
            <div class="boxd">
              <h5>{{ item.wenzi }}</h5>
              <span class="yong">{{ item.jizhu }}</span>
              <span class="p">{{ item.wenzhang }}</span>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: ["yanshenarr", "contentarr1", "contentarr2", "contentarr3"],
  data() {
    return {
      arr: [],
    };
  },
  methods: {
    fun() {
      this.$router.push("/qwe");
    },
  },
  created() {
    this.$store.dispatch("getdata", { url: "/data/asd" });
    if (sessionStorage.getItem("store")) {
      this.$store.replaceState(
        Object.assign(
          {},
          this.$store.state,
          JSON.parse(sessionStorage.getItem("store"))
        )
      );
    }
    //在页面刷新时将vuex里的信息保存到sessionStorage里
    window.addEventListener("beforeunload", () => {
      sessionStorage.setItem("store", JSON.stringify(this.$store.state));
    });
  },
  mounted() {
    this.arr.push(this.$store.getters.contentarr1);
    this.arr.push(this.$store.getters.contentarr2);
    this.arr.push(this.$store.getters.contentarr3);
    // if (location.href.indexOf("#/abc0") == 0) {
    //   location.reload();
    //   location.href = location.href + "#/abc0";
    // }
        if (location.href=="#/abc0") {
      location.reload();
      location.href = location.href + "#/abc0";
    }
    
  },
};
(function aaa() {
  // this.$router.go(0);
  console.log(1);
});
</script>

<style scoped>
.boxa {
  width: 3.42rem;
  margin: 0 auto;
}
.icon-shuxian {
  font-size: 0.3rem;
  color: #6ba6f8;
}
.boxb {
  display: flex;
  font-size: 0.18rem;
  font-weight: 600;
  line-height: 0.66rem;
}
#boxc {
  display: flex;
}

img {
  width: 1.29rem;
  height: 0.9rem;
  margin-right: 0.1rem;
}

.yong {
  font-size: 0.14rem;
}
.boxd {
  display: flex;
  justify-content: space-around;
  flex-direction: column;
  flex-wrap: nowrap;
  align-content: center;
  align-items: baseline;
}
.p {
  font-size: 0.12rem;
  color: rgb(154, 155, 155);
}
</style>